package com.xyc.petmallsystem.repository;

import com.xyc.petmallsystem.pojo.Coupon;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

/**
 * @author Joel
 * @date 2021/11/30
 */
public interface CouponRepository extends JpaRepository<Coupon, Integer> {

    /*
    判断 uuid是否存在
     */
    @Query(value = "select * from coupon where uuid = :uuid", nativeQuery = true)
    Coupon judge(String uuid);

    /*
    获取优惠码记录数
     */
    @Query(value = "select count(*) from coupon", nativeQuery = true)
    Integer getCouponCount();
}
